namespace Sidvall.CodeGenerator.DataObjects
{
    public class Reference
    {
        public string Name { get; set; }

        public ReferenceDataType SourceDataType { get; set; }
        public ReferenceDataType DestinationDataType { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
        public ReferenceFieldCollection Fields { get; private set; }
        public bool ExistsMultipleRelationsBetweenTables { get; set; }
        public bool CascadeDelete { get; set; }

        public string TableKey
        {
            get
            {
                return this.SourceDataType.EntityName + "." + this.DestinationDataType.EntityName;
            }
        }

        public Reference()
        {
            this.Fields = new ReferenceFieldCollection();
            this.ExistsMultipleRelationsBetweenTables = false;
        }
    }
}
